\(\int \sin (e+f x) (2-3 \sin ^2(e+f x)) \, dx\) [6]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 18 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=\frac {\cos (e+f x) \sin ^2(e+f x)}{f} \]

[Out]

cos(f*x+e)*sin(f*x+e)^2/f

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.053, Rules used = {3090} \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=\frac {\sin ^2(e+f x) \cos (e+f x)}{f} \]

[In]

Int[Sin[e + f*x]*(2 - 3*Sin[e + f*x]^2),x]

[Out]

(Cos[e + f*x]*Sin[e + f*x]^2)/f

Rule 3090

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A*Cos[e
+ f*x]*((b*Sin[e + f*x])^(m + 1)/(b*f*(m + 1))), x] /; FreeQ[{b, e, f, A, C, m}, x] && EqQ[A*(m + 2) + C*(m +
1), 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\cos (e+f x) \sin ^2(e+f x)}{f} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(51\) vs. \(2(18)=36\).

Time = 0.05 (sec) , antiderivative size = 51, normalized size of antiderivative = 2.83 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=-\frac {2 \cos (e) \cos (f x)}{f}+\frac {9 \cos (e+f x)}{4 f}-\frac {\cos (3 (e+f x))}{4 f}+\frac {2 \sin (e) \sin (f x)}{f} \]

[In]

Integrate[Sin[e + f*x]*(2 - 3*Sin[e + f*x]^2),x]

[Out]

(-2*Cos[e]*Cos[f*x])/f + (9*Cos[e + f*x])/(4*f) - Cos[3*(e + f*x)]/(4*f) + (2*Sin[e]*Sin[f*x])/f

Maple [A] (verified)

Time = 0.84 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.33

method result size
parallelrisch \(\frac {\cos \left (f x +e \right )-\cos \left (3 f x +3 e \right )}{4 f}\) \(24\)
risch \(\frac {\cos \left (f x +e \right )}{4 f}-\frac {\cos \left (3 f x +3 e \right )}{4 f}\) \(27\)
derivativedivides \(\frac {\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )-2 \cos \left (f x +e \right )}{f}\) \(31\)
default \(\frac {\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )-2 \cos \left (f x +e \right )}{f}\) \(31\)
parts \(\frac {\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{f}-\frac {2 \cos \left (f x +e \right )}{f}\) \(33\)
norman \(\frac {-\frac {4 \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {4 \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{3}}\) \(50\)

[In]

int(sin(f*x+e)*(2-3*sin(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/4*(cos(f*x+e)-cos(3*f*x+3*e))/f

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.22 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=-\frac {\cos \left (f x + e\right )^{3} - \cos \left (f x + e\right )}{f} \]

[In]

integrate(sin(f*x+e)*(2-3*sin(f*x+e)^2),x, algorithm="fricas")

[Out]

-(cos(f*x + e)^3 - cos(f*x + e))/f

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 53 vs. \(2 (15) = 30\).

Time = 0.11 (sec) , antiderivative size = 53, normalized size of antiderivative = 2.94 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=\begin {cases} \frac {3 \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} + \frac {2 \cos ^{3}{\left (e + f x \right )}}{f} - \frac {2 \cos {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (2 - 3 \sin ^{2}{\left (e \right )}\right ) \sin {\left (e \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(sin(f*x+e)*(2-3*sin(f*x+e)**2),x)

[Out]

Piecewise((3*sin(e + f*x)**2*cos(e + f*x)/f + 2*cos(e + f*x)**3/f - 2*cos(e + f*x)/f, Ne(f, 0)), (x*(2 - 3*sin
(e)**2)*sin(e), True))

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.22 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=-\frac {\cos \left (f x + e\right )^{3} - \cos \left (f x + e\right )}{f} \]

[In]

integrate(sin(f*x+e)*(2-3*sin(f*x+e)^2),x, algorithm="maxima")

[Out]

-(cos(f*x + e)^3 - cos(f*x + e))/f

Giac [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.33 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=-\frac {\cos \left (f x + e\right )^{3}}{f} + \frac {\cos \left (f x + e\right )}{f} \]

[In]

integrate(sin(f*x+e)*(2-3*sin(f*x+e)^2),x, algorithm="giac")

[Out]

-cos(f*x + e)^3/f + cos(f*x + e)/f

Mupad [B] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.17 \[ \int \sin (e+f x) \left (2-3 \sin ^2(e+f x)\right ) \, dx=-\frac {\cos \left (e+f\,x\right )\,\left ({\cos \left (e+f\,x\right )}^2-1\right )}{f} \]

[In]

int(-sin(e + f*x)*(3*sin(e + f*x)^2 - 2),x)

[Out]

-(cos(e + f*x)*(cos(e + f*x)^2 - 1))/f